package com.swg.config;

import com.swg.bean.AnimalFactory;
import com.swg.bean.Cat;
import com.swg.bean.Dog;
import com.swg.bean.Person;
import com.swg.condition.LinuxCondition;
import com.swg.condition.WindowsCondition;
import com.swg.selector.MyImportBeanDefinitionRegistrar;
import com.swg.selector.MyImportSelector;
import org.springframework.context.annotation.*;

/**
 * @Author 【swg】.
 * @Date 2018/5/27 20:55
 * @DESC
 * @CONTACT 317758022@qq.com
 */
@Configuration
@Import({MyImportSelector.class,MyImportBeanDefinitionRegistrar.class})
public class MainConfig2 {
    @Bean
    public Person person(){
        return new Person("李四",20,"hh");
    }

    @Conditional({WindowsCondition.class})//传condition数组
    @Bean("bill")
    public Person person01(){
        return new Person("Bill",60,"hh");
    }

    @Conditional(LinuxCondition.class)
    @Bean("linus")
    public Person person02(){
        return new Person("linus",50,"hh");
    }

    @Bean
    public AnimalFactory animalFactory(){
        return new AnimalFactory();
    }
}
